using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DashFx : MonoBehaviour
{
    private SpriteRenderer sr;
    private float colorLooseRate;
    public void Setup(float  colorLooseRate,Sprite srimage)
    {
        sr = GetComponentInChildren<SpriteRenderer>();
        sr.sprite = srimage;
        this.colorLooseRate = colorLooseRate;
    }
    private void UpdateImage()
    {
        float alpha=sr.color.a-colorLooseRate*Time.deltaTime;
        sr.color=new Color(sr.color.r,sr.color.g,sr.color.b,alpha);
        if (sr.color.a <= 0)
            Destroy(gameObject);
    }
    private void Update()
    {
        UpdateImage();
    }
}
